<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: seal
  Date: 2016/3/26
  Time: 14:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登陆</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/mircblog.css"/>
</head>
<body>

<!-- container -->
<div class="container">
    <form id="login-form" action="/other/token/login.do" method="post" class="form-signin">
        <h2 class="form-signin-heading">用户登录</h2>
        <label for="inputTelNo" class="sr-only">电话</label>
        <input type="text" id="inputTelNo"  name="telNo" class="form-control" placeholder="电话" required autofocus>
        <a id="login-bt" class="btn btn-lg btn-primary btn-block">登录</a>
    </form>

    <div id="error" class="alert alert-danger" role="alert">
        ${error }
    </div>

</div>
<!-- container end -->

</body>
<script type="text/javascript" src="/static/jquery.min.js"></script>
<script type="text/javascript" src="/static/bootstrap.min.js"></script>
<script type="application/javascript">
    $(function(){

        $('#login-bt').click(function(){


            $('#error').html("正在登陆请稍后...");
            $.post("/other/token/login.do",{telNo:$('#inputTelNo').val()},function(data){

                if(data.state){
                      location.replace("/other/index.do");
                  }else{
                      $('#error').html(data.msg);
                  }
            });
        });

    });
</script>

</html>
